
package com.thunder.rebot.rebotclient.entity;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.EndPoint;

import java.util.Arrays;

public class Network {

	static public void register (EndPoint endPoint) {
		Kryo kryo = endPoint.getKryo();
		kryo.register(byte[].class);
		kryo.register(Long.class);
		kryo.register(SomeRequest.class);
		kryo.register(SomeResponse.class);
	}

	static public class SomeRequest {
		//发送的类型
		public int sendType=-1;
		//小车的运动方向   sendType----0
		public int type=-1;
		//发送照片   sendType----1
		public byte[] picBit;//图片的byte
		public String name="";//注册人脸的name
		public int picBitLen;//图片的byte
		public int sendNum;//图片的byte
		public int cerrentNum;//发送当前的次数
		//获取照片  sendType----2
		//删除图片的id  sendType----3
		public long id;//要删除的图片的id
        /*
         *服务器向客户端发送 sendType----4 服务端开始处理每一帧视频流 加name
         */
        public int faceX;
        public int faceY;
        public int faceWidth;
        public int faceHeight;
        public int isComplete;//一帧数据是否有人脸 0没有 1有 用于是否清屏

	}

	static public class SomeResponse {
		public int type; //0--小车方向 1--收到图片 2--数据哭查询 3--删除图片
		public byte[] picBit;//查询到图片的byte
		public int picBitLen;//图片的byte
		public int sendNum;//图片的byte
		public int cerrentNum;//发送当前的次数
		public int dataSize;//查询图片的大小
		public long id;

		public String name="";//注册人脸的name
		public int faceX;
		public int faceY;
		public int faceWidth;
		public int faceHeight;
		public int isComplete;//一帧数据是否有人脸清屏 0不清 1清 用于是否清屏

		//是否登录的标示位
		public boolean isRegist = false;


		@Override
		public String toString() {
			return "SomeResponse{" +
					"type=" + type +
					", picBit=" + Arrays.toString(picBit) +
					", picBitLen=" + picBitLen +
					", sendNum=" + sendNum +
					", cerrentNum=" + cerrentNum +
					", dataSize=" + dataSize +
					", id=" + id +
					", name='" + name + '\'' +
					", faceX=" + faceX +
					", faceY=" + faceY +
					", faceWidth=" + faceWidth +
					", faceHeight=" + faceHeight +
					", isComplete=" + isComplete +
					", isRegist=" + isRegist +
					'}';
		}
	}
}
